34 research outputs found

    A General Framework for Static Profiling of Parametric Resource Usage

    Get PDF
    Traditional static resource analyses estimate the total resource usage of a program, without executing it. In this paper we present a novel resource analysis whose aim is instead the static profiling of accumulated cost, i.e., to discover, for selected parts of the program, an estimate or bound of the resource usage accumulated in each of those parts. Traditional resource analyses are parametric in the sense that the results can be functions on input data sizes. Our static profiling is also parametric, i.e., our accumulated cost estimates are also parameterized by input data sizes. Our proposal is based on the concept of cost centers and a program transformation that allows the static inference of functions that return bounds on these accumulated costs depending on input data sizes, for each cost center of interest. Such information is much more useful to the software developer than the traditional resource usage functions, as it allows identifying the parts of a program that should be optimized, because of their greater impact on the total cost of program executions. We also report on our implementation of the proposed technique using the CiaoPP program analysis framework, and provide some experimental results. This paper is under consideration for acceptance in TPLP.Comment: Paper presented at the 32nd International Conference on Logic Programming (ICLP 2016), New York City, USA, 16-21 October 2016, 22 pages, LaTe

    Improved static analysis and verification of energy consumption and other resources via abstract interpretation

    Get PDF
    Resource analysis aims at inferring the cost of executing programs for any possible input, in terms of a given resource, such as the traditional execution steps, time ormemory, and, more recently energy consumption or user defined resources (e.g., number of bits sent over a socket, number of database accesses, number of calls to particular procedures, etc.). This is performed statically, i.e., without actually running the programs. Resource usage information is useful for a variety of optimization and verification applications, as well as for guiding software design. For example, programmers can use such information to choose different algorithmic solutions to a problem; program transformation systems can use cost information to choose between alternative transformations; parallelizing compilers can use cost estimates for granularity control, which tries to balance the overheads of task creation and manipulation against the benefits of parallelization. In this thesis we have significatively improved an existing prototype implementation for resource usage analysis based on abstract interpretation, addressing a number of relevant challenges and overcoming many limitations it presented. The goal of that prototype was to show the viability of casting the resource analysis as an abstract domain, and howit could overcome important limitations of the state-of-the-art resource usage analysis tools. For this purpose, it was implemented as an abstract domain in the abstract interpretation framework of the CiaoPP system, PLAI.We have improved both the design and implementation of the prototype, for eventually allowing an evolution of the tool to the industrial application level. The abstract operations of such tool heavily depend on the setting up and finding closed-form solutions of recurrence relations representing the resource usage behavior of program components and the whole program as well. While there exist many tools, such as Computer Algebra Systems (CAS) and libraries able to find closed-form solutions for some types of recurrences, none of them alone is able to handle all the types of recurrences arising during program analysis. In addition, there are some types of recurrences that cannot be solved by any existing tool. This clearly constitutes a bottleneck for this kind of resource usage analysis. Thus, one of the major challenges we have addressed in this thesis is the design and development of a novel modular framework for solving recurrence relations, able to combine and take advantage of the results of existing solvers. Additionally, we have developed and integrated into our novel solver a technique for finding upper-bound closed-form solutions of a special class of recurrence relations that arise during the analysis of programs with accumulating parameters. Finally, we have integrated the improved resource analysis into the CiaoPP general framework for resource usage verification, and specialized the framework for verifying energy consumption specifications of embedded imperative programs in a real application, showing the usefulness and practicality of the resulting tool.---ABSTRACT---El An谩lisis de recursos tiene como objetivo inferir el coste de la ejecuci贸n de programas para cualquier entrada posible, en t茅rminos de alg煤n recurso determinado, como pasos de ejecuci贸n, tiempo o memoria, y, m谩s recientemente, el consumo de energ铆a o recursos definidos por el usuario (por ejemplo, n煤mero de bits enviados a trav茅s de un socket, el n煤mero de accesos a una base de datos, cantidad de llamadas a determinados procedimientos, etc.). Ello se realiza est谩ticamente, es decir, sin necesidad de ejecutar los programas. La informaci贸n sobre el uso de recursos resulta muy 煤til para una gran variedad de aplicaciones de optimizaci贸n y verificaci贸n de programas, as铆 como para asistir en el dise帽o de los mismos. Por ejemplo, los programadores pueden utilizar dicha informaci贸n para elegir diferentes soluciones algor铆tmicas a un problema; los sistemas de transformaci贸n de programas pueden utilizar la informaci贸n de coste para elegir entre transformaciones alternativas; los compiladores paralelizantes pueden utilizar las estimaciones de coste para realizar control de granularidad, el cual trata de equilibrar el coste debido a la creaci贸n y gesti贸n de tareas, con los beneficios de la paralelizaci贸n. En esta tesis hemos mejorado de manera significativa la implementaci贸n de un prototipo existente para el an谩lisis del uso de recursos basado en interpretaci贸n abstracta, abordando diversos desaf铆os relevantes y superando numerosas limitaciones que 茅ste presentaba. El objetivo de dicho prototipo era mostrar la viabilidad de definir el an谩lisis de recursos como un dominio abstracto, y c贸mo se pod铆an superar las limitaciones de otras herramientas similares que constituyen el estado del arte. Para ello, se implement贸 como un dominio abstracto en el marco de interpretaci贸n abstracta presente en el sistema CiaoPP, PLAI. Hemos mejorado tanto el dise帽o como la implementaci贸n del mencionado prototipo para posibilitar su evoluci贸n hacia una herramienta utilizable en el 谩mbito industrial. Las operaciones abstractas de dicha herramienta dependen en gran medida de la generaci贸n, y posterior b煤squeda de soluciones en forma cerrada, de relaciones recurrentes, las cuales modelizan el comportamiento, respecto al consumo de recursos, de los componentes del programa y del programa completo. Si bien existen actualmente muchas herramientas capaces de encontrar soluciones en forma cerrada para ciertos tipos de recurrencias, tales como Sistemas de Computaci贸n Algebraicos (CAS) y librer铆as de programaci贸n, ninguna de dichas herramientas es capaz de tratar, por s铆 sola, todos los tipos de recurrencias que surgen durante el an谩lisis de recursos. Existen incluso recurrencias que no las puede resolver ninguna herramienta actual. Esto constituye claramente un cuello de botella para este tipo de an谩lisis del uso de recursos. Por lo tanto, uno de los principales desaf铆os que hemos abordado en esta tesis es el dise帽o y desarrollo de un novedoso marco modular para la resoluci贸n de relaciones recurrentes, combinando y aprovechando los resultados de resolutores existentes. Adem谩s de ello, hemos desarrollado e integrado en nuestro nuevo resolutor una t茅cnica para la obtenci贸n de cotas superiores en forma cerrada de una clase caracter铆stica de relaciones recurrentes que surgen durante el an谩lisis de programas l贸gicos con par谩metros de acumulaci贸n. Finalmente, hemos integrado el nuevo an谩lisis de recursos con el marco general para verificaci贸n de recursos de CiaoPP, y hemos instanciado dicho marco para la verificaci贸n de especificaciones sobre el consumo de energ铆a de programas imperativas embarcados, mostrando la viabilidad y utilidad de la herramienta resultante en una aplicaci贸n real

    Towards Energy Consumption Verification via Static Analysis

    Full text link
    In this paper we leverage an existing general framework for resource usage verification and specialize it for verifying energy consumption specifications of embedded programs. Such specifications can include both lower and upper bounds on energy usage, and they can express intervals within which energy usage is to be certified to be within such bounds. The bounds of the intervals can be given in general as functions on input data sizes. Our verification system can prove whether such energy usage specifications are met or not. It can also infer the particular conditions under which the specifications hold. To this end, these conditions are also expressed as intervals of functions of input data sizes, such that a given specification can be proved for some intervals but disproved for others. The specifications themselves can also include preconditions expressing intervals for input data sizes. We report on a prototype implementation of our approach within the CiaoPP system for the XC language and XS1-L architecture, and illustrate with an example how embedded software developers can use this tool, and in particular for determining values for program parameters that ensure meeting a given energy budget while minimizing the loss in quality of service.Comment: Presented at HIP3ES, 2015 (arXiv: 1501.03064

    An Approach to Static Performance Guarantees for Programs with Run-time Checks

    Full text link
    Instrumenting programs for performing run-time checking of properties, such as regular shapes, is a common and useful technique that helps programmers detect incorrect program behaviors. This is specially true in dynamic languages such as Prolog. However, such run-time checks inevitably introduce run-time overhead (in execution time, memory, energy, etc.). Several approaches have been proposed for reducing such overhead, such as eliminating the checks that can statically be proved to always succeed, and/or optimizing the way in which the (remaining) checks are performed. However, there are cases in which it is not possible to remove all checks statically (e.g., open libraries which must check their interfaces, complex properties, unknown code, etc.) and in which, even after optimizations, these remaining checks still may introduce an unacceptable level of overhead. It is thus important for programmers to be able to determine the additional cost due to the run-time checks and compare it to some notion of admissible cost. The common practice used for estimating run-time checking overhead is profiling, which is not exhaustive by nature. Instead, we propose a method that uses static analysis to estimate such overhead, with the advantage that the estimations are functions parameterized by input data sizes. Unlike profiling, this approach can provide guarantees for all possible execution traces, and allows assessing how the overhead grows as the size of the input grows. Our method also extends an existing assertion verification framework to express "admissible" overheads, and statically and automatically checks whether the instrumented program conforms with such specifications. Finally, we present an experimental evaluation of our approach that suggests that our method is feasible and promising.Comment: 15 pages, 3 tables; submitted to ICLP'18, accepted as technical communicatio

    Solving Recurrence Relations using Machine Learning, with Application to Cost Analysis

    Full text link
    Automatic static cost analysis infers information about the resources used by programs without actually running them with concrete data, and presents such information as functions of input data sizes. Most of the analysis tools for logic programs (and other languages) are based on setting up recurrence relations representing (bounds on) the computational cost of predicates, and solving them to find closed-form functions that are equivalent to (or a bound on) them. Such recurrence solving is a bottleneck in current tools: many of the recurrences that arise during the analysis cannot be solved with current solvers, such as Computer Algebra Systems (CASs), so that specific methods for different classes of recurrences need to be developed. We address such a challenge by developing a novel, general approach for solving arbitrary, constrained recurrence relations, that uses machine-learning sparse regression techniques to guess a candidate closed-form function, and a combination of an SMT-solver and a CAS to check whether such function is actually a solution of the recurrence. We have implemented a prototype and evaluated it with recurrences generated by a cost analysis system (the one in CiaoPP). The experimental results are quite promising, showing that our approach can find closed-form solutions, in a reasonable time, for classes of recurrences that cannot be solved by such a system, nor by current CASs.Comment: In Proceedings ICLP 2023, arXiv:2308.1489

    Programaci贸n orientada a agentes en el marco de lenguajes multiparadigmas

    Get PDF
    La presente l铆nea de investigaci贸n surge de dos observaciones. Por un lado, observamos que el paradigma orientado a agentes a煤n hoy no se encuentra consensuadamente definido dentro de las diferentes 谩reas de las ciencias de la computaci贸n. Por el otro lado, la combinaci贸n de conceptos y herramientas de los diferentes paradigmas de programaci贸n en lenguajes actuales demostraron ser la v铆a m谩s adecuada para la elaboraci贸n de herramientas de desarrollo de software que permitan representar adecuadamente los problemas y soluciones de dominios de la vida real. A partir de estas observaciones comenzamos una investigaci贸n cuyo objetivo es establecer las bases para dar origen a una definici贸n definitiva del paradigma orientado a agentes, mostrando que constituye la convergencia entre los dem谩s paradigmas. Con este fin nos proponemos desarrollar un lenguaje de programaci贸n que incorpore sus ideas elementales de manera arm贸nica. Para su desarrollo escogimos un lenguaje multiparadigma basado en la programaci贸n l贸gica, por sus numerosas extensiones y la facilidad con la que permite definir nuevas estructuras sint谩cticas, sem谩nticas y de control. Como conclusi贸n de este trabajo utilizaremos el nuevo lenguaje para desarrollar aplicaciones pr谩cticas en diversos campos como la rob贸tica, la dom贸tica, el desarrollo de aplicaciones m贸viles, etc.Eje: Agentes y Sistemas inteligentesRed de Universidades con Carreras en Inform谩tica (RedUNCI

    Programaci贸n orientada a agentes en el marco de lenguajes multiparadigmas

    Get PDF
    La presente l铆nea de investigaci贸n surge de dos observaciones. Por un lado, observamos que el paradigma orientado a agentes a煤n hoy no se encuentra consensuadamente definido dentro de las diferentes 谩reas de las ciencias de la computaci贸n. Por el otro lado, la combinaci贸n de conceptos y herramientas de los diferentes paradigmas de programaci贸n en lenguajes actuales demostraron ser la v铆a m谩s adecuada para la elaboraci贸n de herramientas de desarrollo de software que permitan representar adecuadamente los problemas y soluciones de dominios de la vida real. A partir de estas observaciones comenzamos una investigaci贸n cuyo objetivo es establecer las bases para dar origen a una definici贸n definitiva del paradigma orientado a agentes, mostrando que constituye la convergencia entre los dem谩s paradigmas. Con este fin nos proponemos desarrollar un lenguaje de programaci贸n que incorpore sus ideas elementales de manera arm贸nica. Para su desarrollo escogimos un lenguaje multiparadigma basado en la programaci贸n l贸gica, por sus numerosas extensiones y la facilidad con la que permite definir nuevas estructuras sint谩cticas, sem谩nticas y de control. Como conclusi贸n de este trabajo utilizaremos el nuevo lenguaje para desarrollar aplicaciones pr谩cticas en diversos campos como la rob贸tica, la dom贸tica, el desarrollo de aplicaciones m贸viles, etc.Eje: Agentes y Sistemas inteligentesRed de Universidades con Carreras en Inform谩tica (RedUNCI

    A General Framework for Static Cost Analysis of Parallel Logic Programs

    Get PDF
    The estimation and control of resource usage is now an important challenge in an increasing number of computing systems. In particular, requirements on timing and energy arise in a wide variety of applications such as internet of things, cloud computing, health, transportation, and robots. At the same time, parallel computing, with (heterogeneous) multi-core platforms in particular, has become the dominant paradigm in computer architecture. Predicting resource usage on such platforms poses a difficult challenge. Most work on static resource analysis has focused on sequential programs, and relatively little progress has been made on the analysis of parallel programs, or more specifically on parallel logic programs. We propose a novel, general, and flexible framework for setting up cost equations/relations which can be instantiated for performing resource usage analysis of parallel logic programs for a wide range of resources, platforms, and execution models. The analysis estimates both lower and upper bounds on the resource usage of a parallel program (without executing it) as functions on input data sizes. In addition, it also infers other meaningful information to better exploit and assess the potential and actual parallelism of a system. We develop a method for solving cost relations involving the max function that arise in the analysis of parallel programs. Finally, we instantiate our general framework for the analysis of logic programs with Independent AndParallelism, report on an implementation within the CiaoPP system, and provide some experimental results. To our knowledge, this is the first approach to the cost analysis of parallel logic programs

    A Transformational Approach to Parametric Accumulated-Cost Static Profiling

    Get PDF
    Traditional static resource analyses estimate the total resource usage of a program, without executing it. In this paper we present a novel resource analysis whose aim is instead the static profiling of accumulated cost, i.e., to discover, for selected parts of the program, an estimate or bound of the resource usage accumulated in each of those parts. Traditional resource analyses are parametric in the sense that the results can be functions on input data sizes. Our static profiling is also parametric, i.e., our accumulated cost estimates are also parameterized by input data sizes. Our proposal is based on the concept of cost centers and a program transformation that allows the static inference of functions that return bounds on these accumulated costs depending on input data sizes, for each cost center of interest. Such information is much more useful to the software developer than the traditional resource usage functions, as it allows identifying the parts of a program that should be optimized, because of their greater impact on the total cost of program executions. We also report on our implementation of the proposed technique using the CiaoPP program analysis framework, and provide some experimental results

    Interval-based Resource Usage Verification by Translation into Horn Clauses and an Application to Energy Consumption

    Full text link
    Many applications require conformance with specifications that constrain the use of resources, such as execution time, energy, bandwidth, etc. We have presented a configurable framework for static resource usage verification where specifications can include lower and upper bound, data size-dependent resource usage functions. To statically check such specifications, our framework infers the same type of resource usage functions, which safely approximate the actual resource usage of the program, and compares them against the specification. We review how this framework supports several languages and compilation output formats by translating them to an intermediate representation based on Horn clauses and using the configurability of the framework to describe the resource semantics of the input language. We provide a more detailed formalization and extend the framework so that both resource usage specification and analysis/verification output can include preconditions expressing intervals for the input data sizes for which assertions are applicable, proved, or disproved. Most importantly, we also extend the classes of functions that can be checked. We provide results from an implementation within the Ciao/CiaoPP framework, and report on a tool built by instantiating this framework for the verification of energy consumption specifications for imperative/embedded programs. This paper is under consideration for publication in Theory and Practice of Logic Programming (TPLP).Comment: Under consideration for publication in Theory and Practice of Logic Programming (TPLP
    corecore